<?php
$this->breadcrumbs = array(
    'Users' => array('index'),
    'Manage',
);

$this->menu = array(
    array('label' => 'List User', 'url' => array('index')),
    array('label' => 'Create User', 'url' => array('create'), 'visible' => Yii::app()->user->checkAccess("admin")),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('user-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Users</h1>



<?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?>
<div class="search-form" style="display:none">
    <?php
    $this->renderPartial('_search', array(
        'model' => $model,
    ));
    ?>
</div><!-- search-form -->



<?php
$this->widget('bootstrap.widgets.TbGridView', array(
    'type' => 'striped bordered condensed',
    'id' => 'user-grid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'template' => "{items}",
    'columns' => array(
        array('name' => 'id', 'header' => '#'),
        array('name' => 'first_name', 'header' => 'First name'),
        array('name' => 'username', 'header' => 'username'),
        array('name' => 'email', 'header' => 'email Address'),
        array('name' => 'address', 'header' => 'Address'),
        array('name' => 'country', 'header' => 'country'),
        array('name' => 'status', 'header' => 'Status'),
        
        array(
            'class' => 'bootstrap.widgets.TbButtonColumn',
            'template' => '{view}{update}{delete}{active}{inactive}',
            'buttons' => array
                (
                'active' => array
                    (
                   
                    'url' => '$this->grid->controller->createUrl("/user/approve", array("id"=>$data->id))',
                    'imageUrl' => Yii::app()->request->baseUrl . '/images/like.png',
                ),
                'inactive' => array
                    (
                    'url' => '$this->grid->controller->createUrl("/user/disApprove", array("id"=>$data->id))',
                    'imageUrl' => Yii::app()->request->baseUrl . '/images/dis_like.png',
                ),
            ),
            'htmlOptions' => array('style' => 'width: 50px'),
        ),
    ),
));
?>
